package io.github.uicdb.et.net;

import io.github.uicdb.et.ElementalTheory;
import net.minecraft.core.BlockPos;
import net.minecraft.network.RegistryFriendlyByteBuf;
import net.minecraft.network.codec.StreamCodec;
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
import net.minecraft.resources.ResourceLocation;
import org.jetbrains.annotations.NotNull;

public record CCraftInPosPayload(BlockPos pos) implements CustomPacketPayload {
    public static final CustomPacketPayload.Type<CCraftInPosPayload> TYPE = new Type<>(
            ResourceLocation.fromNamespaceAndPath(ElementalTheory.MODID,"craft_in_pos"));
    public static final StreamCodec<RegistryFriendlyByteBuf, CCraftInPosPayload> STREAM_CODEC = StreamCodec.composite(
            BlockPos.STREAM_CODEC,
            CCraftInPosPayload::pos,
            CCraftInPosPayload::new
    );

    @Override
    public @NotNull Type<? extends CustomPacketPayload> type() {
        return TYPE;
    }
}
